package com.radar.common;

import org.meteoinfo.global.Extent;
import org.meteoinfo.global.MIMath;

public class Common {

    /**
     * Obtain according to the radius and center latitude and longitude Extent
     *
     * @param lon
     * @param lat
     * @param tlen
     * @return
     */
    public static Extent getExtentRadius(double lon, double lat, double tlen) {
        double m_dDisCircleLon = lon;
        double m_dDisCircleLat = lat;
        double tyLen;
        double txLen = tyLen = tlen / 111319.5;
        double num14 = Math.cos(m_dDisCircleLat * Const.DEG2RAD);
        txLen = txLen / num14;
        double txRd = txLen;
        double tyRd = tyLen;
        double minLon = m_dDisCircleLon - txRd;
        double maxLon = m_dDisCircleLon + txRd;
        double minLat = m_dDisCircleLat - tyRd;
        double maxLat = m_dDisCircleLat + tyRd;
        return new Extent(minLon, maxLon, minLat, maxLat);
    }




}
